<template>
  <el-select
    v-model="selectId"
    clearable
    filterable
    :placeholder="$language.local('请输入') + $language.local('BankName')"
    @change="selectChange"
    class="el-select"
  >
    <el-option
      v-for="item in options"
      :key="item.BANKNAME"
      :label="item.BANKNAME"
      :value="item.BANKNAME"
    >
    </el-option>
  </el-select>
</template>

<script>
export default {
  props: {
    value: String,
  },
  data() {
    return {
      selectId: this.value,
      options: [],
    };
  },
  created() {
    this.getOptions();
  },
  watch: {
    value(newValue) {
      this.selectId = newValue;
    },
  },
  // computed: {
  //   selectId: this.value,
  // },
  methods: {
    async getOptions() {
      let response = await this.$http.get("/api/Common/GetBankItem");
      this.options = response.data.Data;
    },
    selectChange(e) {
      this.$emit("input", e);
    },
  },
};
</script>

<style lang="less" scoped>
.el-select {
  width: 100%;
}
</style>
